package com.missilike.admin.task;

import com.missilike.biz.IMilAccountService;
import com.missilike.biz.IMilContentStatisticService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class BaseTask {


    private final IMilAccountService milAccountService;

    private final IMilContentStatisticService milContentStatisticService;

    @Autowired
    public BaseTask(IMilAccountService milAccountService, IMilContentStatisticService milContentStatisticService) {
        this.milAccountService = milAccountService;
        this.milContentStatisticService = milContentStatisticService;
    }

    @Scheduled(cron="0 0 0 * * ?")
    private void resetDisableUser(){
        log.info("task resetDisableUser start");
        milAccountService.resetDisableUser();
        log.info("task resetDisableUser end");
    }

    @Scheduled(cron="0 0 0 * * ?")
    private void importStatisticInfo(){
        log.info("task importStatisticInfo start");
        milContentStatisticService.importStatisticInfo();
        log.info("task importStatisticInfo end");
    }
}
